<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>

    <script src="js/jquery-3.3.1.js"></script>

    <script>
        $(function () {
            $("#submit").click(function () {
                const $username = $("input[name=username]").val();
                const $email = $("input[name=email]").val();

                if ($username !== "" && $email !== ""){
                    alert("用户名： " + $username + "\n 电子邮箱： " + $email);
                }else {
                    alert("请输入后再点击")
                }
            })
        })
    </script>
</head>
<body>

<form action="">
    <label>用户名：</label><input type="text" name="username"><br>
    <label>电子邮箱：</label><input type="email" name="email"><br>
    <button type="submit" id="submit">提交</button>
</form>

</body>
</html>
